Localization

The Nova user interface can be viewed in different languages. Individual tools can contain language resource files for translation.

Language resource files

Language resources files are used to specify what the user interface displays for parameter names and other labels in different languages. Separate files are used for each supported language, and they should be stored in the /resources/lang subfolder of an app.

The following languages are supported, using the specified file names:

Names for language files in <app>/resources/lang/

Language

File name

Chinese

zh.json

English

en.json

French

fr.json

German

de.json

Italian

it.json

Japanese

ja.json

Korean

ko.json

Spanish

es.json

A language file contains a json dictionary that maps identifiers to the text to display.

{
  "Identifier": "Translated text"
}

For example, this parameter definition:

    {name="PostProcess", type="bool", default="true"}

produces this control in the user interface, when there are no language files:

../../_images/localization-post-process-untranslated.png

Appearance of boolean parameter without language file.

By adding the following mapping in resources/lang/en.json:

{
  "PostProcess": "Perform post processing"
}

it will instead appear like this, when the selected language is English:

../../_images/localization-post-process.png

Appearance of boolean parameter with language file.

Tool description

The language files can contain a "ToolDescription" key with text that is shown under the tool name in the panel in the user interface:

{
  "ToolDescription": "My Tool description"
}
../../_images/overview-tool-description.png

String access in Lua

Translated strings are in most cases applied automatically, for example for translated tool and parameter names, or enum values in the user interface.

It is also possible to access the string for a label in the currently selected language from the tool code, using self:getText in an extension method

getText example

This example uses self:getText and output.log to display a translated message in the user interface.

This code, in the execute method of a tool:

output.log.warning(self.getText("AppropriateWarning"))

with the following contents in “en.json”:

"AppropriateWarning" : "This warning is appropriate for the current situation"

will show the following in the user interface:

../../_images/overview-language-warning.png